package com.bwie.controller;

import com.bwie.unit.OSSFileUtil;
import com.bwie.unit.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("user")
public class FileController {

    @PostMapping("upload")
    public R upload(MultipartFile file) throws IOException {
        OSSFileUtil ossFileUtil = new OSSFileUtil();
        String s = ossFileUtil.uploadFile(file);
        return R.OK(s);
    }

}
